#define _CRT_SECUR_NO_WARNINGS
using namespace std;
#include<string>
#include<iostream>

//int main() {
//	string s1;
//	string s2 = "hello";
//	string s3("world");
//	string s4 = s1 + s2;
//	string s5 = "hello" + s2;
//	string s6 = "hello" + s2 + "world";
//	string s7(5, 'c');
//	//string s8 = "hello" + "world";
//	printf("%s\n",s1);
//	printf("%s\n", s2);
//	printf("%s\n", s3);
//	printf("%s\n", s4);
//	printf("%s\n", s5);
//	printf("%s\n", s6);
//	printf("%s\n", s7);
//	return 0;
//
//}

class student {
public:
	//student();//无参构造函数

	student(string Name = "小王", int Age =22);//缺省构造函数

	student(const student& S) {//自定义拷贝构造函数
		cout << "调用拷贝构造函数" << endl;
		this->name = "未知";
		this->age = 0;
	}

	~student()//析构函数（默认）
	{

	};
	void setname(string Name);
	void setage(int Age) {
		this->age = Age;
	}
	string getname()const;
	int getage()const;
private:
	string name;
	int age;
};

//student::student() {
//	cout << "缺省构造函数" << endl;
//};//无参构造函数

student::student(string Name, int Age) {//缺省构造函数：参数都有默认值
	
	this->name = Name;
	this->age = Age;
	cout << "调用缺省构造函数" << endl;
};

void student::setname(string Name) {
	this->name = Name;
};
int student::getage()const {
	return this->age;
}

string student:: getname() const{
	return this->name;
}

int main() {
	student STU;
	cout << "name：" << STU.getname() << " " << "age:" << STU.getage() << endl;
	STU.setname("张笑雨");
	STU.setage(22);
	cout << "name：" << STU.getname() <<" " << "age:" << STU.getage() << endl;
	student S1=STU;
	cout << "name：" << S1.getname() << " " << "age:" << S1.getage() << endl;
	return 0;
}

//严重性	代码	说明	项目	文件	行	禁止显示状态
//错误	C2668	“student::student”: 对重载函数的调用不明确	
//↑表示无参构造函数和缺省构造函数编译器也不知道使用哪一个